import request from '@/utils/request'

export async function login(data) {
  return await request({
    url: '/adminSever/admin/login',
    method: 'post',
    data
  })
}

export async function getInfo(token) {
  return await request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export async function logout() {
  return await request({
    url: '/adminSever/admin/logout',
    method: 'get'
  })
}

/**
 * 修改管理员信息
 * @param {data} data 
 * @returns 
 */
export async function edit(data) {
  return await request({
    url: '/adminSever/admin/edit',
    method: 'PUT',
    data
  })
}

/**
 * 校验管理员密码
 * @param {data} data 
 * @returns 
 */
export async function validPassword(data) {
  return await request({
    url: '/adminSever/admin/validPassword',
    method: 'POST',
    data
  })
}
